﻿using BlondeHeaven.DTO;
using BlondeHeaven.DAL;
using Microsoft.Extensions.DependencyInjection;
using BlondeHeaven.DTO.Interface;
using BlondeHeaven.BLL.Interface;
using BlondeHeaven.BLL;
using BlondeHeaven.DAL.Interface;

namespace BlondeHeaven.UI
{
    /// <summary>
    /// Bll层依赖注入
    /// </summary>
    public class BllRegister
    {

        public void Register(IServiceCollection services)
        {

            ///注入用户User 业务

            services.AddTransient(typeof(IDalUserService<>), typeof(DalUserService<>));
            services.AddTransient(typeof(IDTUserService), typeof(DTUserService));


            ///注入Shop业务
            // 用于实例化Dal对象，获取上下文对象
            services.AddTransient(typeof(IDalShopKeeperService<>), typeof(DalShopKeeperService<>));
            //用户于实例化Bll层的业务，获取业务
            services.AddTransient(typeof(IBllShopKeeperService<>), typeof(BllShopKeeperService<>));



            //Shop的两种注入方式  这一种比较规范，走DTO连接  灵感来源于Java   
            //services.AddTransient(typeof(IDalShopKeeperService<>), typeof(DalShopKeeperService<>));
            //services.AddTransient(typeof(IDTShopKeeperService), typeof(DTShopKeeperService));




            ///注入Shop业务
            // 用于实例化Dal对象，获取上下文对象
            services.AddTransient(typeof(IDalCommodityService<>), typeof(DalCommodityService<>));
            //用户于实例化Bll层的业务，获取业务
            services.AddTransient(typeof(IBllCommodityService<>), typeof(BllCommodityService<>));




        }

    }
}
